import React from 'react'
import { Typography } from '@mui/material';
import './index.scss'
import { useNavigate } from 'react-router-dom';
interface Props {
    
}

const Index = (props: Props) => {
    const userInfo=JSON.parse(localStorage.getItem('userInfo'));
    const navigate=useNavigate();
    const handleLogout=()=>{
        localStorage.removeItem('accessToken');
        localStorage.removeItem('refreshToken');
        navigate('/login');
    }
    return (
        <div className='avator'>
            <p><img src={userInfo.avator} alt="" /></p>
            <p>{userInfo?userInfo.username:'暂无昵称'}</p>
            <div className="out" onClick={handleLogout}>
                退出登录
            </div>
        </div>
        

    )
}

export default Index
